import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
     {
      path: '/',
      name: 'login',
      component: () => import('../views/LoginView.vue'),
    },
    {
      path: '/home',
      name: 'home',
      redirect:'/home/btn',  // /home/btn
      component: HomeView,
      children:[
        {
          path:'btn',
          name:'button',
          component:()=>import('@/views/ButtonView.vue')
        },
        {
          path:'form',
          name:'form',
          component:()=>import('@/views/FormView.vue')
        },
        {
          path:'table',
          name:'table',
          component:()=>import('@/views/TableView.vue')
        },
        {
          path:'layout1',
          name:'layout1',
          component:()=>import('@/views/LayoutView.vue')
        },
      ]
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
    },
    {
          path:'/layout',
          name:'layout',
          component:()=>import('@/views/Layout.vue'),
          children:[
             {
            path: '/teacher',
            name: 'teacher',
            component: () => import('../views/teacher/Teacher.vue'),
            },
             {
            path: '/user/list',
            name: 'userList',
            component: () => import('@/views/user/DeptList.vue'),
            },
             {
            path: '/user/add',
            name: 'userAdd',
            component: () => import('@/views/user/EmpList.vue'),
            },
            {
            path: '/student/list',
            name: 'studentList',
            component: () => import('@/views/student/StudentList.vue'),
            },
            {
            path: '/student/clazz',
            name: 'classList',
            component: () => import('@/views/student/ClassList.vue'),
            },
          ]
    },
  ],
})

export default router
